
//
//  txlTableViewController.m
//  shuilijuOASystem
//
//  Created by michael on 16/10/27.
//  Copyright © 2016年 czd. All rights reserved.
//

#import "txlTableViewController.h"
#import "OAAddressViewController.h"
#import "gerenbumenViewController.h"

@interface txlTableViewController ()
@property (nonatomic,strong)NSArray* array;
@end

@implementation txlTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"单位通讯录";
    _array = [NSArray arrayWithObjects:@"个人通讯录",@"单位通讯录",nil];
     self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
   UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:nil action:nil];
    self.navigationItem.backBarButtonItem = barButtonItem;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{
return 2;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//       static NSString * cellIdentifier = @"cellIdentifier";
//            UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
//            if (cell == nil) {
//                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
//            }
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 40, 40)];
    image.image = [UIImage imageNamed: _array[indexPath.row]];
[cell.contentView addSubview:image];
//    cell.imageView.image = [UIImage imageNamed: _array[indexPath.row]];
    cell.imageView.size = CGSizeMake(30 ,30);
    UILabel *textLabel = [[UILabel alloc]init];
    textLabel.frame = CGRectMake(image.right+10, 5, 100, 60);
    textLabel.text = _array[indexPath.row];
    [cell.contentView addSubview:textLabel];
   
//    if (indexPath.row==0) {
//        label.text = self.reads;
//        if ([self.reads integerValue] !=0) {
//            label.hidden = NO;
//        }else{
//         label.hidden = YES;
//        }
//    }else{
//    label.hidden = YES;
//    
//    }


    
    
    
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 70;
}

- (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

if (indexPath.row==0) {
    gerenbumenViewController *invc = [[gerenbumenViewController alloc]init];
    [self.navigationController pushViewController:invc animated:YES];
}
if(indexPath.row==1) {
      UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

   OAAddressViewController * addressVC = (OAAddressViewController*)[storyBoard
    instantiateViewControllerWithIdentifier:@"AddressVCID"];
        [self.navigationController pushViewController:addressVC animated:YES];
    }


}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
